<?php
require(dirname(__FILE__) .'/check.php');
$skin->CheckIframe();

$userSysArr = Cache::PhpFile('userSys');


/* **** 版权所有 ****

 程序开发：网钛科技
 网钛CMS官网：http://otcms.com
 网钛IDC官网：http://idccms.com
 ＱＱ：877873666
 微信：QQ877873666
 邮箱：877873666@qq.com

 **** 版权所有 **** */



//用户检测
$MB->Open('','login');


switch($mudi){
	case 'switch':
		SwitchDeal();
		break;

	case 'switchAddi':
		SwitchAddiDeal();
		break;

	case 'switchColl':
		SwitchCollDeal();
		break;

	case 'switchSelect':
		SwitchSelectDeal();
		break;

	case 'switchExsit':
		SwitchExsitDeal();
		break;

	default:
		die('err');
}

$MB->Close();
$DB->Close();





// 修改状态
function SwitchDeal(){
	global $DB,$MB,$menuFileID,$menuTreeID,$dataType,$systemArr;

	$tabName	= OT::GetStr('tabName');
	$fieldName	= OT::GetStr('fieldName');
	$fieldName2	= OT::GetStr('fieldName2');
	$dataID		= OT::GetInt2( OT::ParaArr('id') );
		if (! in_array($fieldName, array('state', 'wapState', 'userState', 'isUser', 'isAdminUser', 'isMenu', 'isSubMenu', 'isHome', 'isWap', 'isWapHome', 'isHomeWap', 'isUse', 'isRunCode', 'isRecom', 'isLock', 'isSel', 'isList', 'isTop', 'isReg', 'isLogin'))){
			JS::AlertEnd('操作字段不再允许范围内('. $fieldName .').');
		}

	$tabArr = array(
		'menuTree'		=> array('MT_',	'admin',	'alert'),
		'fileVer'		=> array('FV_', 'admin',	'alert'),
		'paySoft'		=> array('PS_', 'admin',	'alert'),
		'makeDiy'		=> array('MD_', 'admin',	'alert'),
		'siteLogin'		=> array('SL_', 'admin',	'alert'),
		'message'		=> array('MA_',		16,		'alert'),
		'infoMessage'	=> array('IM_', 	151,	'alert'),
		'infoMove'		=> array('IM_', 	13,		'alert'),
		'infoType'		=> array('IT_', 	94,		'alert'),
		'infoWeb'		=> array('IW_', 	15,		'alert'),
		'info'			=> array('IF_', 	11,		'alert'),
		'keyWord'		=> array('KW_', 	138,	'alert'),
		'ad'			=> array('AD_', 	148,	'alert'),
		'banner'		=> array('BN_', 	288,	'alert'),
		'users'			=> array('UE_', 	187,	'alert'),
		'userApi'		=> array('UA_', 	202,	'alert'),
		'userGroup'		=> array('UG_', 	182,	'alert'),
		'userMoney'		=> array('UM_', 	248,	'alert'),
		'vote'			=> array('VT_', 	126,	'alert'),
		'bbsData'		=> array('BD_', 	222,	'alert'),
		'formType'		=> array('FT_', 	230,	'alert'),
		'formField'		=> array('FF_', 	231,	'alert'),
		'goUrl'			=> array('GU_', 	234,	'alert'),
		'goUrlBrowser'	=> array('GUB_', 	234,	'alert'),
		'taokeGoods'	=> array('TG_', 	252,	'alert'),
		'taokeWord'		=> array('TW_', 	250,	'alert'),
		'taokeItem'		=> array('TI_', 	489,	'alert'),
		'giftData'		=> array('GD_', 	274,	'alert'),
		'moneyPay'		=> array('MP_', 	268,	'alert'),
		'moneyRecord'	=> array('MR_', 	265,	'alert'),
		'quanData'		=> array('QD_', 	405,	'alert'),
		'weixinMenu'	=> array('WM_', 	236,	'alert'),
		'weixinUserGroup'=> array('WUG_', 	237,	'alert'),
		'weixinTplSet'	=> array('WTS_', 	240,	'alert'),
		'mailInfo'		=> array('MI_', 	420,	'alert'),
		'mailTpl'		=> array('MT_', 	415,	'alert'),
		'phoneTpl'		=> array('PT_', 	426,	'alert'),
		'bbsData'		=> array('BD_', 	222,	'alert'),
		'bbsReply'		=> array('BR_', 	226,	'alert'),
		'moneyGive'		=> array('MG_', 	264,	'alert'),
		'workData'		=> array('WD_', 	532,	'alert'),
		'oneWebTpl'		=> array('OWT_', 	552,	'alert'),
		'oneWebType'	=> array('OWT_', 	552,	'alert'),
		'oneWebUsers'	=> array('OWU_', 	552,	'alert'),
		'fans'			=> array('FN_', 	557,	'alert'),
		'report'		=> array('RP_', 	571,	'alert'),
		'tag'			=> array('TAG_', 	577,	'alert'),
		'apiItem'		=> array('AI_', 	665,	'alert'),
		'apiUsers'		=> array('AU_', 	665,	'alert'),
		'caGroup'		=> array('CG_', 	148,	'alert'),
		'caType'		=> array('CT_', 	148,	'alert'),
		'caData'		=> array('CD_', 	148,	'alert'),
		'onePage'		=> array('OP_', 	660,	'alert'),
		'diyPayList'	=> array('DPL_', 	274,	'alert'),
		'agentUsers'	=> array('AU_', 	'admin','alert'),
		'quanSell'		=> array('QS_', 	691,	'alert'),
		'xcxApiUsers'	=> array('XAU_', 	730,	'alert'),
		'xcxUsers'		=> array('XU_', 	697,	'alert'),
		'xcxTixing'		=> array('XT_', 	735,	'alert'),
		'xcxDingyue'	=> array('XD_', 	745,	'alert'),
		'xcxFamily'		=> array('XF_', 	702,	'alert'),
		'xcxPhoto'		=> array('XP_', 	740,	'alert'),
		'xcxBaby'		=> array('XB_', 	707,	'alert'),
		'xcxBabyFeed'	=> array('XBF_', 	712,	'alert'),
		'xcxBabyDeve'	=> array('XBD_', 	717,	'alert'),
		'xcxBabyNote'	=> array('XBN_', 	725,	'alert'),
		'xcxShopType'	=> array('XST_', 	750,	'alert'),
		'xcxShopGoods'	=> array('XSG_', 	755,	'alert'),
		'xcxShopOrder'	=> array('XSO_', 	760,	'alert'),
		'xcxAdWord'		=> array('XAW_', 	768,	'alert'),
		'*****'			=> array('00_', 	000,	'')
		);

	if (! isset($tabArr[$tabName]) ){
		JS::AlertEnd('操作表不再允许范围内('. OT_dbPref . $tabName .').');
	}
	$tabFiled1	= $tabArr[$tabName][0];
	$tabFiled2	= $fieldName;

	$whereStr = '';
	switch ($tabName){
		case 'infoMove':
			if ($MB->IsSecMenuRight('jud',13,$dataType)==false && $MB->IsSecMenuRight('jud',54,$dataType)==false){
				JS::AlertEnd('您无权限.');
			}
			break;
	
		case 'infoWeb':
			if ($MB->IsSecMenuRight('jud',15,$dataType)==false && $MB->IsSecMenuRight('jud',57,$dataID)==false){
				JS::AlertEnd('您无权限.');
			}
			break;
	}

	$menuFileID	= $tabArr[$tabName][1];
	if ($menuFileID == 'admin'){
		$MB->IsAdminRight($tabArr[$tabName][2]);
	}else{
		$MB->IsSecMenuRight($tabArr[$tabName][2],$menuFileID,$dataType);
	}

	$runTab = '';
	if ($tabName=='info' && ($tabFiled2=='state' || $tabFiled2=='wapState') && $systemArr['SYS_newsShowUrlMode']=='html-2.x'){
		if ($tabFiled2 == 'wapState'){ $runTab = 'infoWap'; }else{ $runTab = 'info'; }
		$whereStr = ',IF_pageCount,IF_infoTypeDir,IF_datetimeDir';
	}elseif ($tabName=='infoMessage' && $tabFiled2=='state'){
		$runTab = 'infoMessage';
		$whereStr = ',IM_isGetScore,IM_userID,IM_infoID,IM_content';
	}elseif ($tabName=='message' && $tabFiled2=='state'){
		$runTab = 'message';
		$whereStr = ',MA_isGetScore,MA_userID,MA_content';
	}elseif ($tabName=='bbsData' && $tabFiled2=='state'){
		$runTab = 'bbsData';
		$whereStr = ',BD_isGetScore,BD_userID,BD_theme';
	}elseif ($tabName=='bbsReply' && $tabFiled2=='state'){
		$runTab = 'bbsReply';
		$whereStr = ',BR_isGetScore,BR_userID,BR_themeID,BR_content';
	}elseif ($tabName=='paySoft' && $tabFiled2=='state'){
		$runTab = 'paySoft';
		$whereStr = ',PS_phpVer,PS_phpVerMax';
	}elseif ($tabName=='users' && $tabFiled2=='state'){
		$runTab = 'users';
		$whereStr = ',UE_recomId,UE_isRecomScore';
	}

	$staterec=$DB->query('select '. $tabFiled1 .'ID,'. $tabFiled1 . $tabFiled2 . $whereStr .' from '. OT_dbPref . $tabName .' where '. $tabFiled1 .'ID='. $dataID);
		if (! $row = $staterec->fetch()){
			JS::AlertEnd('出错！该记录已不存在，请刷新页面。');
		}else{
			$record=array();
			if ($row[$tabFiled1 . $tabFiled2] == 1){
				$record[$tabFiled1 . $tabFiled2] = 0;

				if ($runTab == 'info'){
					File::Del(OT_ROOT . Url::NewsID($row['IF_infoTypeDir'],$row['IF_datetimeDir'],$dataID,0));
					if ($row['IF_pageCount']>1){
						for ($i=2; $i<=$row['IF_pageCount']; $i++){
							File::Del(OT_ROOT . Url::NewsID($row['IF_infoTypeDir'],$row['IF_datetimeDir'],$dataID,$i));
						}
					}
				}elseif ($runTab == 'infoWap'){
					File::Del(OT_ROOT .'wap/'. Url::NewsID($row['IF_infoTypeDir'],$row['IF_datetimeDir'],$dataID,0));
					if ($row['IF_pageCount']>1){
						for ($i=2; $i<=$row['IF_pageCount']; $i++){
							File::Del(OT_ROOT .'wap/'. Url::NewsID($row['IF_infoTypeDir'],$row['IF_datetimeDir'],$dataID,$i));
						}
					}
				}

				echo('<script language="javascript" type="text/javascript">parent.$id("'. $fieldName2 . $dataID .'").innerHTML=\''. Adm::SwitchCN(0,$fieldName2) .'\';</script>');
			}else{
				$record[$tabFiled1 . $tabFiled2] = 1;

				if ($runTab == 'info'){
					echo('
					<script language="javascript" type="text/javascript">
					try {
						parent.$id("infoHtmlBox'. $dataID .'").innerHTML=\'<iframe id="infoIframe'. $dataID .'" name="infoIframe'. $dataID .'" frameborder="0" allowTransparency="true" scrolling="no" style="width:60px;height:20px;" src="makeHtml_deal.php?mudi=newsMini&htmlEachSec=1&htmlEachNum=99&startNum=0&dataID='. $dataID .'&rnd='. time() .'"></iframe>\';
						parent.WindowHeight(-1);
					}catch (e) {}
					</script>
					');
				}elseif ($runTab == 'infoWap' && AppWap::Jud()){
					echo('
					<script language="javascript" type="text/javascript">
					try {
						parent.$id("infoHtmlBox'. $dataID .'").innerHTML=\'<iframe id="infoIframeWap'. $dataID .'" name="infoIframeWap'. $dataID .'" frameborder="0" allowTransparency="true" scrolling="no" style="width:60px;height:20px;" src="makeHtml_deal.php?mudi=newsMini&mode=wap&htmlEachSec=1&htmlEachNum=99&startNum=0&dataID='. $dataID .'&rnd='. time() .'"></iframe>\';
						parent.WindowHeight(-1);
					}catch (e) {}
					</script>
					');
				}elseif ($tabName=='paySoft' && $tabFiled2=='state'){
					if ( $row['PS_phpVer'] > 0 && OT::VerCompare( floatval($row['PS_phpVer']) ) < 0 ){
						JS::AlertEnd('该插件要求PHP版本不低于v'. $row['PS_phpVer'] .'，但你当前PHP版本是v'. PHP_VERSION .'，不符合使用要求。');
					}elseif ( $row['PS_phpVerMax'] > 0 && OT::VerCompare( floatval($row['PS_phpVerMax']) ) > 0 ){
						JS::AlertEnd('该插件要求PHP版本不高于v'. $row['PS_phpVerMax'] .'，但你当前PHP版本是v'. PHP_VERSION .'，不符合使用要求。');
					}
				}

				echo('<script language="javascript" type="text/javascript">parent.$id("'. $fieldName2 . $dataID .'").innerHTML=\''. Adm::SwitchCN(1,$fieldName2) .'\';</script>');
			}
			$judRes = $DB->UpdateParam($tabName,$record,$tabFiled1 .'ID='. $dataID);
			if ($judRes && $record[$tabFiled1 . $tabFiled2] == 1){
				if ($tabName == 'users' && $row['UE_isRecomScore'] == 0 && $row['UE_recomId'] > 0){
					AppRecom::UpdateFatRecomNum($row['UE_recomId'], 1, 'db');
				}elseif ($runTab == 'infoMessage'){
					if ($row['IM_userID'] > 0 && $row['IM_state'] == 0 && $row['IM_isGetScore'] == 0){
						$usArr = Users::AddScore('infoMessage', $row['IM_userID'], $dataID, $row['IM_infoID'], '', $row['IM_content']);
						if ($usArr['res']){
							// JS::AlertEnd($usArr['note']);
							JS::DiyEnd('parent.$id("themeAddi'. $dataID .'").innerHTML="[已获得积分，'. $usArr['note'] .']";');
						}elseif (! empty($usArr['note'])){
							JS::DiyEnd('parent.$id("themeAddi'. $dataID .'").innerHTML="['. $usArr['note'] .']";');
						}
					}

				}elseif ($runTab == 'message'){
					if ($row['MA_userID'] > 0 && $row['MA_state'] == 0 && $row['MA_isGetScore'] == 0){
						$usArr = Users::AddScore('message', $row['MA_userID'], $dataID, 0, '', $row['MA_content']);
						if ($usArr['res']){
							// JS::AlertEnd($usArr['note']);
							JS::DiyEnd('parent.$id("themeAddi'. $dataID .'").innerHTML="[已获得积分，'. $usArr['note'] .']";');
						}elseif (! empty($usArr['note'])){
							JS::DiyEnd('parent.$id("themeAddi'. $dataID .'").innerHTML="['. $usArr['note'] .']";');
						}
					}

				}elseif ($runTab == 'bbsData'){
					if ($row['BD_userID'] > 0 && $row['BD_state'] == 0 && $row['BD_isGetScore'] == 0){
						$usArr = Users::AddScore('bbsWriteAdd', $row['BD_userID'], $dataID, 0, '', $row['BD_theme']);
						if ($usArr['res']){
							// JS::AlertEnd($usArr['note']);
							JS::DiyEnd('parent.$id("themeAddi'. $dataID .'").innerHTML="[已获得积分，'. $usArr['note'] .']";');
						}elseif (! empty($usArr['note'])){
							JS::DiyEnd('parent.$id("themeAddi'. $dataID .'").innerHTML="['. $usArr['note'] .']";');
						}
					}

				}elseif ($runTab == 'bbsReply'){
					if ($row['BR_userID'] > 0 && $row['BR_state'] == 0 && $row['BR_isGetScore'] == 0){
						$usArr = Users::AddScore('bbsReplyAdd', $row['BR_userID'], $dataID, $row['BR_themeID'], '', $row['BR_content']);
						if ($usArr['res']){
							// JS::AlertEnd($usArr['note']);
							JS::DiyEnd('parent.$id("themeAddi'. $dataID .'").innerHTML="[已获得积分，'. $usArr['note'] .']";');
						}elseif (! empty($usArr['note'])){
							JS::DiyEnd('parent.$id("themeAddi'. $dataID .'").innerHTML="['. $usArr['note'] .']";');
						}
					}

				}
			}
		}
	unset($staterec);

	if ($tabName == 'ad'){
		if (! Ca::MakeJs()){
			echo('
			<script language="javascript" type="text/javascript">
			alert("生成 cache/ads.js 缓存文件失败，请检查根目录下的cache/目录是否有写入权限。");
			</script>
			');
		}

	}elseif ($tabName == 'userApi'){
		AdmArea::UserApiHtml();

	}elseif ($tabName == 'users'){
		AppRecom::AuditScore($dataID);

	}elseif ($tabName == 'paySoft'){
		AdmArea::PaySoftStateDeal($dataID);

	}

}



// 修改文章属性状态
function SwitchAddiDeal(){
	global $DB,$MB,$menuFileID,$menuTreeID,$dataType,$systemArr,$userSysArr;

	$tabName	= OT::GetStr('tabName');
	$fieldValue	= OT::GetStr('fieldValue');
	$fieldName	= OT::GetStr('fieldName');
	$fieldName2	= OT::GetStr('fieldName2');
	$fieldValue2= OT::GetStr('fieldValue2');
	$dataID		= OT::GetInt2( OT::ParaArr('id') );
	$name		= OT::GetStr('name');
		if (strpos('|isAudit|isNew|isHomeThumb|isThumb|isImg|isFlash|isMarquee|isRecom|isTop|event|','|'. $fieldName .'|')===false){
			JS::AlertEnd('操作字段不再允许范围内.');
		}

	$whereStr = '';
	switch ($tabName){
		case 'info':
			$menuFileID = 10;
			$MB->IsSecMenuRight('alert',$menuFileID,$dataType);
			$tabFiled1 = 'IF_';
			$tabFiled2 = $fieldName;
			$whereStr = ',IF_typeStr,IF_type1ID,IF_type2ID,IF_type3ID,IF_isGetScore,IF_getScore1,IF_getScore2,IF_getScore3,IF_userID,IF_img,IF_theme,IF_pageCount,IF_infoTypeDir,IF_datetimeDir,IF_state,IF_wapState';
			break;

		case 'users':
			$menuFileID = 187;
			$MB->IsSecMenuRight('alert',$menuFileID,$dataType);
			$tabFiled1 = 'UE_';
			$tabFiled2 = $fieldName;
			break;

		case 'fans':
			$menuFileID = 557;
			$MB->IsSecMenuRight('alert',$menuFileID,$dataType);
			$tabFiled1 = 'FN_';
			$tabFiled2 = $fieldName;
			break;

		default :
			JS::AlertEnd('操作表不再允许范围内('. OT_dbPref . $tabName .').');
			break;
	}

	if ($tabName == 'info'){
		$staterec=$DB->query('select IF_ID,IF_'. $tabFiled2 . $whereStr .' from '. OT_dbPref . $tabName .' where IF_ID='. $dataID);
		if (! $row = $staterec->fetch()){
			JS::AlertEnd('出错！该记录已不存在，请刷新页面。');
		}else{
			$record=array();
			if ($row['IF_'. $tabFiled2] == 1){
				$record['IF_'. $tabFiled2]	= 0;
				if ($tabFiled2=='isAudit'){
					if ($row['IF_isGetScore']==1 && $row['IF_userID']>0){
						$record['IF_isGetScore']	= 0;
						$record['IF_getScore1']		= 0;
						$record['IF_getScore2']		= 0;
						$record['IF_getScore3']		= 0;
						Users::UpdateScore($row['IF_userID'], '-', $row['IF_getScore1'], $row['IF_getScore2'], $row['IF_getScore3']);

						if (AppUserScore::IsAdd($row['IF_getScore1'], $row['IF_getScore2'], $row['IF_getScore3'])){
							$uexe = $DB->query('select UE_username,UE_score1,UE_score2,UE_score3 from '. OT_dbPref .'users where UE_ID='. $row['IF_userID']);
							if ($urow = $uexe->fetch()){
								$scoreArr = array();
								$scoreArr['UM_userID']		= $row['IF_userID'];
								$scoreArr['UM_username']	= $urow['UE_username'];
								$scoreArr['UM_type']		= 'audit0';
								$scoreArr['UM_dataID']		= $row['IF_ID'];
								$scoreArr['UM_typeStr']		= $row['IF_typeStr'];
								$scoreArr['UM_type1ID']		= $row['IF_type1ID'];
								$scoreArr['UM_type2ID']		= $row['IF_type2ID'];
								$scoreArr['UM_type3ID']		= $row['IF_type3ID'];
								$scoreArr['UM_score1']		= $row['IF_getScore1']*(-1);
								$scoreArr['UM_score2']		= $row['IF_getScore2']*(-1);
								$scoreArr['UM_score3']		= $row['IF_getScore3']*(-1);
								$scoreArr['UM_remScore1']	= $urow['UE_score1'];
								$scoreArr['UM_remScore2']	= $urow['UE_score2'];
								$scoreArr['UM_remScore3']	= $urow['UE_score3'];
								$scoreArr['UM_note']		= '文章审核不通过回收积分['. Info::InfoTypeCN($row['IF_type1ID'], $row['IF_type2ID'], $row['IF_type3ID']) .']《'. $row['IF_theme'] .'》';
								AppUserScore::AddData($scoreArr);
							}
							unset($uexe);
						}
					}

					if ($systemArr['SYS_newsShowUrlMode']=='html-2.x'){
						File::Del(OT_ROOT . Url::NewsID($row['IF_infoTypeDir'],$row['IF_datetimeDir'],$dataID,0));
						File::Del(OT_ROOT .'wap/'. Url::NewsID($row['IF_infoTypeDir'],$row['IF_datetimeDir'],$dataID,0));
						if ($row['IF_pageCount']>1){
							for ($i=2; $i<=$row['IF_pageCount']; $i++){
								File::Del(OT_ROOT . Url::NewsID($row['IF_infoTypeDir'],$row['IF_datetimeDir'],$dataID,$i));
								File::Del(OT_ROOT .'wap/'. Url::NewsID($row['IF_infoTypeDir'],$row['IF_datetimeDir'],$dataID,$i));
							}
						}
					}

				}
				echo('
				<script language="javascript" type="text/javascript">
				parent.$id("'. $fieldName2 . $dataID .'").innerHTML=\''. Adm::Switch2CN($name,0) .'\';
				</script>
				');
			
			}else{
				$record['IF_'. $tabFiled2]	= 1;
				if ($tabFiled2=='isAudit'){
					if ($row['IF_isGetScore']==0 && $row['IF_userID']>0){
						$newsAddScoreArr = Users::ScoreArr('newsAdd');
						if ($newsAddScoreArr['US_score1'] < 0 || $newsAddScoreArr['US_score2'] < 0 || $newsAddScoreArr['US_score3'] < 0){
							$urs = $DB->GetRow('select UE_score1,UE_score2,UE_score3 from '. OT_dbPref .'users where UE_ID='. $row['IF_userID']);
							if ($urs){
								$uAlertStr = '';
								if ($urs['UE_score1'] + $newsAddScoreArr['US_score1'] < 0){ $uAlertStr .= $userSysArr['US_score1Name'] .'：'. $urs['UE_score1'] .'，不足以扣除 '. abs($newsAddScoreArr['US_score1']); }
								if ($urs['UE_score2'] + $newsAddScoreArr['US_score2'] < 0){ $uAlertStr .= $userSysArr['US_score2Name'] .'：'. $urs['UE_score2'] .'，不足以扣除 '. abs($newsAddScoreArr['US_score2']); }
								if ($urs['UE_score3'] + $newsAddScoreArr['US_score3'] < 0){ $uAlertStr .= $userSysArr['US_score3Name'] .'：'. $urs['UE_score3'] .'，不足以扣除 '. abs($newsAddScoreArr['US_score3']); }
								if (strlen($uAlertStr) > 0){
									JS::AlertEnd('付费投稿积分不足，禁止审核通过.\n\n'. $uAlertStr);
								}
							}
						}
						$record['IF_isGetScore']	= 1;
						$record['IF_getScore1']		= $newsAddScoreArr['US_score1'];
						$record['IF_getScore2']		= $newsAddScoreArr['US_score2'];
						$record['IF_getScore3']		= $newsAddScoreArr['US_score3'];
						Users::UpdateScore($row['IF_userID'], '+', $newsAddScoreArr['US_score1'], $newsAddScoreArr['US_score2'], $newsAddScoreArr['US_score3']);
						
						if (AppUserScore::IsAdd($newsAddScoreArr['US_score1'], $newsAddScoreArr['US_score2'], $newsAddScoreArr['US_score3'])){
							$uexe = $DB->query('select UE_username,UE_score1,UE_score2,UE_score3 from '. OT_dbPref .'users where UE_ID='. $row['IF_userID']);
							if ($urow = $uexe->fetch()){
								$scoreArr = array();
								$scoreArr['UM_userID']		= $row['IF_userID'];
								$scoreArr['UM_username']	= $urow['UE_username'];
								$scoreArr['UM_type']		= 'audit1';
								$scoreArr['UM_dataID']		= $row['IF_ID'];
								$scoreArr['UM_typeStr']		= $row['IF_typeStr'];
								$scoreArr['UM_type1ID']		= $row['IF_type1ID'];
								$scoreArr['UM_type2ID']		= $row['IF_type2ID'];
								$scoreArr['UM_type3ID']		= $row['IF_type3ID'];
								$scoreArr['UM_score1']		= $newsAddScoreArr['US_score1'];
								$scoreArr['UM_score2']		= $newsAddScoreArr['US_score2'];
								$scoreArr['UM_score3']		= $newsAddScoreArr['US_score3'];
								$scoreArr['UM_remScore1']	= $urow['UE_score1'];
								$scoreArr['UM_remScore2']	= $urow['UE_score2'];
								$scoreArr['UM_remScore3']	= $urow['UE_score3'];
								$scoreArr['UM_note']		= '文章审核通过['. Info::InfoTypeCN($row['IF_type1ID'], $row['IF_type2ID'], $row['IF_type3ID']) .']《'. $row['IF_theme'] .'》';
								AppUserScore::AddData($scoreArr);
							}
							unset($uexe);
						}
					}

					if ($systemArr['SYS_newsShowUrlMode']=='html-2.x'){
						if ($dataID==0){ $dataID=$DB->GetOne('select max(IF_ID) from '. OT_dbPref .'info'); }
						$makeStr = '';
						if ($row['IF_state']==1){
							$makeStr .= '<div><iframe id="infoIframe'. $dataID .'" name="infoIframe'. $dataID .'" frameborder="0" allowTransparency="true" scrolling="no" style="width:60px;height:20px;" src="makeHtml_deal.php?mudi=newsMini&htmlEachSec=1&htmlEachNum=99&startNum=0&dataID='. $dataID .'&rnd='. time() .'"></iframe></div>';
						}
						if ($row['IF_wapState']==1 && AppWap::Jud()){
							$makeStr .= '<div><iframe id="infoIframeWap'. $dataID .'" name="infoIframeWap'. $dataID .'" frameborder="0" allowTransparency="true" scrolling="no" style="width:60px;height:20px;" src="makeHtml_deal.php?mudi=newsMini&mode=wap&htmlEachSec=1&htmlEachNum=99&startNum=0&dataID='. $dataID .'&rnd='. time() .'"></iframe></div>';
						}
						if (strlen($makeStr) > 0){
							echo('
							<script language="javascript" type="text/javascript">
							try {
								parent.$id("infoHtmlBox'. $dataID .'").innerHTML=\''. $makeStr .'\';
								parent.WindowHeight(0);
							}catch (e) {}
							</script>
							');
						}
					}

				}elseif (strpos('|isHomeThumb|isThumb|isImg|isFlash|','|'. $tabFiled2 .'|')!==false){
					if (strlen($row['IF_img'])<3){
						die('
						<script language="javascript" type="text/javascript">
						alert("该文章没有缩略图，不能开启该属性。");
						</script>
						');
					}

				}
				echo('
				<script language="javascript" type="text/javascript">
				parent.$id("'. $fieldName2 . $dataID .'").innerHTML=\''. Adm::Switch2CN($name,1) .'\';
				</script>
				');
			}
			$DB->UpdateParam($tabName, $record ,'IF_ID='. $dataID);
		}
		unset($staterec);
	
	}else{
		$staterec=$DB->query('select '. $tabFiled1 . $tabFiled2 . $whereStr .' from '. OT_dbPref . $tabName .' where '. $tabFiled1 .'ID='. $dataID);
		if (! $row = $staterec->fetch()){
			JS::AlertEnd('出错！该记录已不存在，请刷新页面。');
		}else{
			$record=array();
			if (empty($row[$tabFiled1 . $tabFiled2])){ $row[$tabFiled1 . $tabFiled2] = ' '; }
			if (strpos($row[$tabFiled1 . $tabFiled2],$fieldValue2) !== false){
				$record[$tabFiled1 . $tabFiled2] = str_replace($fieldValue2,'',$row[$tabFiled1 . $tabFiled2]);
				echo('
				<script language="javascript" type="text/javascript">
				parent.$id("'. $fieldName2 . $dataID .'").innerHTML=\''. Adm::Switch2CN($name,'') .'\';
				</script>
				');
			
			}else{
				$record[$tabFiled1 . $tabFiled2] = $row[$tabFiled1 . $tabFiled2] . $fieldValue2;
				echo('
				<script language="javascript" type="text/javascript">
				parent.$id("'. $fieldName2 . $dataID .'").innerHTML=\''. Adm::Switch2CN($name,$fieldValue2) .'\';
				</script>
				');
			}
			$DB->UpdateParam($tabName, $record ,$tabFiled1 .'ID='. $dataID);
		}
		unset($staterec);

	}

}



// 修改采集功能状态
function SwitchCollDeal(){
	global $collDB,$MB,$menuFileID,$menuTreeID,$dataType,$sysAdminArr,$collDbName;

	$tabName	= OT::GetStr('tabName');
	$fieldName	= OT::GetStr('fieldName');
	$fieldName2	= OT::GetStr('fieldName2');
	$dataID		= OT::GetInt2( OT::ParaArr('id') );
		if (in_array($fieldName,array('state','userState','isUser','isMenu','isSubMenu','isHome','isWap','isWapHome','isUse','isRunCode','isLock','isList'))==false){
			JS::AlertEnd('操作字段不再允许范围内('. $fieldName .').');
		}

	// 获取采集数据库对象
	$collDB = AreaApp::GetCollDB();

	switch ($tabName){
		case 'collType':
			$menuFileID = 159;
			$MB->IsSecMenuRight('alert',$menuFileID,$dataType);
			$tabFiled1 = 'CT_';
			$tabFiled2 = $fieldName;
			break;

		case 'collItem':
			$menuFileID = 164;
			$MB->IsSecMenuRight('alert',$menuFileID,$dataType);
			$tabFiled1 = 'CI_';
			$tabFiled2 = $fieldName;
			break;

		default :
			JS::AlertEnd('操作表不再允许范围内('. OT_collDbPref . $tabName .').');
			break;
	}

	$staterec=$collDB->query('select '. $tabFiled1 .'ID,'. $tabFiled1 . $tabFiled2 .' from '. OT_collDbPref . $tabName .' where '. $tabFiled1 .'ID='. $dataID);
		if (! $row = $staterec->fetch()){
			JS::AlertEnd('出错！该记录已不存在，请刷新页面。');
		}else{
			$record=array();
			if ($row[$tabFiled1 . $tabFiled2] == 1){
				$record[$tabFiled1 . $tabFiled2] = 0;
				echo('<script language="javascript" type="text/javascript">parent.$id("'. $fieldName2 . $dataID .'").innerHTML=\''. Adm::SwitchCN(0,$fieldName2) .'\';</script>');
			}else{
				$record[$tabFiled1 . $tabFiled2]=1;
				echo('<script language="javascript" type="text/javascript">parent.$id("'. $fieldName2 . $dataID .'").innerHTML=\''. Adm::SwitchCN(1,$fieldName2) .'\';</script>');
			}
			$collDB->UpdateParam(OT_collDbPref . $tabName,$record,$tabFiled1 .'ID='. $dataID);
		}
	unset($staterec);

}



// 修改下拉框模式状态
function SwitchSelectDeal(){
	global $DB,$MB,$menuFileID,$menuTreeID,$dataType,$systemArr,$userSysArr;

	$tabName	= OT::GetStr('tabName');
	$fieldName	= OT::GetStr('fieldName');
	$selData	= OT::GetRegExpStr('selData','abcnum');
	$dataID		= OT::GetInt2( OT::ParaArr('id') );
		if (strpos('|state|isHome|isList|isNews|','|'. $fieldName .'|')===false){
			JS::AlertEnd('操作字段不再允许范围内.');
		}
		if (strlen($selData)<=0){ JS::AlertEnd('选择值不能为空.'); }

	switch ($tabName){
		case 'taokeGoods':
			$menuFileID = 156;
//			$MB->IsSecMenuRight('alert',$menuFileID,$dataType);
			$tabFiled1 = 'TG_';
			$tabFiled2 = $fieldName;
			break;

		default :
			JS::AlertEnd('操作表不再允许范围内('. OT_dbPref . $tabName .').');
			break;
	}

	$dealrec=$DB->query('select '. $tabFiled1 .'ID,'. $tabFiled1 . $tabFiled2 .' from '. OT_dbPref . $tabName .' where '. $tabFiled1 .'ID='. $dataID);
		if (! $row = $dealrec->fetch()){
			JS::AlertEnd('出错！该记录已不存在，请刷新页面。');
		}else{
			$record=array();
			$record[$tabFiled1 . $tabFiled2] = $selData;
			$DB->UpdateParam($tabName, $record ,$tabFiled1 .'ID='. $dataID);

			echo('
			<script language="javascript" type="text/javascript">
			parent.$id("'. $fieldName . $dataID .'").value=\''. $selData .'\';
			parent.$id("'. $fieldName . $dataID .'Alert").innerHTML=\'<span style="color:green;">完成</span>\';
			</script>
			');

		}
	unset($dealrec);

}



// 修改状态
function SwitchExsitDeal(){
	global $DB,$MB,$menuFileID,$menuTreeID,$dataType;

	$tabName	= OT::GetStr('tabName');
	$fieldName	= OT::GetStr('fieldName');
	$fieldName2	= OT::GetStr('fieldName2');
	$fieldValue	= OT::GetStr('fieldValue');
	$addiExt	= OT::GetStr('addiExt');
	$dataID		= OT::GetInt2( OT::ParaArr('id') );
		if (! in_array($fieldName,array('rightStr'))){
			JS::AlertEnd('操作字段不再允许范围内('. $fieldName .').');
		}

	switch ($tabName){
		case 'weixinUsers':
			$menuFileID = 16;
			$MB->IsSecMenuRight('alert',$menuFileID,$dataType);
			$tabFiled1 = 'WU_';
			$tabFiled2 = $fieldName;
			break;

		default :
			JS::AlertEnd('操作表不再允许范围内('. OT_dbPref . $tabName .').');
			break;
	}

	$staterec=$DB->query('select '. $tabFiled1 .'ID,'. $tabFiled1 . $tabFiled2 .' from '. OT_dbPref . $tabName .' where '. $tabFiled1 .'ID='. $dataID);
		if (! $row = $staterec->fetch()){
			JS::AlertEnd('出错！该记录已不存在，请刷新页面。');
		}else{
			if (strpos($row[$tabFiled1 . $tabFiled2],$fieldValue) === false){
				$retStr = $row[$tabFiled1 . $tabFiled2] . $fieldValue;
				echo('<script language="javascript" type="text/javascript">parent.$id("'. $fieldName2 . $dataID . $addiExt .'").innerHTML=\''. Adm::SwitchCN(1,$fieldName2) .'\';</script>');
			}else{
				$retStr = str_replace($fieldValue,'',$row[$tabFiled1 . $tabFiled2]);
				echo('<script language="javascript" type="text/javascript">parent.$id("'. $fieldName2 . $dataID . $addiExt .'").innerHTML=\''. Adm::SwitchCN(0,$fieldName2) .'\';</script>');
			}

			$record=array();
			$record[$tabFiled1 . $tabFiled2]=$retStr;

			$DB->UpdateParam($tabName,$record,$tabFiled1 .'ID='. $dataID);
		}
	unset($staterec);

}

?>